FROM php:7.4-cli
# https://hub.docker.com/_/php

RUN apt-get update

#安装必要的扩展 扩展posix已经默认开启 还需要pcntl sockets
RUN docker-php-ext-install pcntl sockets

#安装event event扩展依赖libevent-dev
RUN apt-get install libevent-dev -y  \
  && sh -c '/bin/echo -e "no\nyes\n/usr\nno\nyes\nno\nyes\nno" | pecl install event' \
  && docker-php-ext-enable event

#启用正式环境的php.ini配置文件
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

#用workerman用户来运行容器
#RUN groupadd -g 1000 workerman
#RUN useradd -g dev -u 1000 workerman

#USER workerman

CMD ["php", "/app/start.php", "start"]
#使用 docker run -dit -v /your/workerman/project/path:/path your_image_name php /path start.php